package org.hysoft.spiderclient;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;

/**
 * Created by cl on 16/6/11.
 */
public class Client {
    public static void main(String[] args)
    {
        try{
        TTransport tTransport=new TSocket("localhost",8091);
        tTransport.open();
        TProtocol tProtocol=new TBinaryProtocol(tTransport);
        Spider.Client client=new Spider.Client(tProtocol);
        for (int i=0;i<10000;i++)
        {
            client.spiderPush("hello"+i);
            System.out.println(i);
            Thread.sleep(100);
        }
        tTransport.close();
        }
        catch (TTransportException e)
        {
            e.printStackTrace();
        } catch (TException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
